package seatiger.tomcat.catalina;

/**
 * 容器启动过程中的异常
 */
public class LifecycleException extends Exception{
    private String message;
    private Throwable throwable;
    public LifecycleException(String message,Throwable throwable){
        this.message = message;
        this.throwable = throwable;
    }

    public LifecycleException(){
        this(null,null);
    }
    public LifecycleException(String message){
        this(message,null);
    }
    public LifecycleException(Throwable throwable){
        this(null,throwable);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("LifecycleException:  ");
        if (message != null) {
            sb.append(message);
            if (throwable != null) {
                sb.append(":  ");
            }
        }
        if (throwable != null) {
            sb.append(throwable);
        }
        return sb.toString();
    }

    public Throwable getThrowable() {
        return throwable;
    }
}
